package com.ms.game.sendgift.db;

import java.util.ArrayList;

import com.ms.game.sendgift.NotifyData;
import com.ms.game.sendgift.message.SendGiftAllNotifyResponse;
import com.ms.service.error.ErrorCode;
import com.xpec.c4.game.utility.GUID;
import com.xpec.c4.message.MessageTypes;
import com.xpec.c4.service.message.MessageAction;
import com.xpec.c4.service.module.task.TaskAsyncCommand;

public class LoadGiftRecordDataAsync extends TaskAsyncCommand {

	public GUID playerID;
	
	public GUID sessionID;
	
	/**
	 * 起始座標
	 */
	public long start;
	
	/**
	 * 長度
	 */
	public int length;
	
	public SendGiftAllNotifyResponse response;
	
	@Override
	public void asyncExecute() throws Exception {
		ArrayList<NotifyData> notifyDatas = SendGiftRecordDAO.loadGiftRecordByPlayerIDLimit(playerID, start, length);
		response.recordData = notifyDatas;
	}

	@Override
	public void execute() throws Exception {
		response.errorCode = ErrorCode.SUCCESS;
		MessageAction.sendMessage(sessionID, MessageTypes.S_GIFT_GET_RECORD_RESPONSE, response);
	}
}
